package com.example.mybatisplus.mapper;

import com.example.mybatisplus.dto.TestTypeHandlerDTO;
import com.example.mybatisplus.enums.TypeName;
import com.example.mybatisplus.pojo.Other;
import com.example.mybatisplus.typehandler.TestTypeHandler;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.type.JdbcType;

@Mapper
public interface TestTypeHandlerDTOMapper {
    @Results(id="TestTypeHandlerDTOMapper",value = {
            @Result(id=true,column = "id",property = "id"),
            @Result(column ="other_name",property = "otherName",javaType = TypeName.class,jdbcType = JdbcType.VARCHAR,typeHandler = TestTypeHandler.class),
            @Result(column = "other_create_time",property = "otherCreateTime")
    })
    @Select("select * from other where id=#{id}")
    public TestTypeHandlerDTO selectById(long id);
}
